package com.cytech.cloudclinic.adapter;

import com.chad.library.adapter.base.BaseNodeAdapter;
import com.chad.library.adapter.base.entity.node.BaseNode;
import com.cytech.cloudclinic.adapter.provide.FirstNode;
import com.cytech.cloudclinic.adapter.provide.RootNodeProvider;
import com.cytech.cloudclinic.adapter.provide.SecondNode;
import com.cytech.cloudclinic.adapter.provide.SecondNodeProvider;

import java.util.List;

public class TemplateAdapter extends BaseNodeAdapter {

    public TemplateAdapter() {
        //增加头部适配器
        addFullSpanNodeProvider(new RootNodeProvider());
        //添加内容适配器
        addNodeProvider(new SecondNodeProvider());
    }

    @Override
    protected int getItemType(List<? extends BaseNode> data, int position) {
        BaseNode node = data.get(position);
        if(node instanceof FirstNode){
            return 0;
        }else if(node instanceof SecondNode){
            return 1;
        }
        return -1;

    }
}
